import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class MmsDb extends JFrame implements ActionListener {
	private JPanel paneOne;

	private JPanel paneTwo;

	private JButton add, select, del, update;

	private String strDb[] = new String[30];

	private int sgridx = 0; // 第0列

	private int sgridy = 0; // 第0行

	private int sgridwidth = GridBagConstraints.REMAINDER; // 占一单位宽度

	private int sgridheight = 1; // 占一单位高度

	private int sweightx = 0; // 窗口增大时组件宽度增大比率0

	private int sweighty = 0; // 窗口增大时组件高度增大比率0

	private int sanchor = GridBagConstraints.CENTER; // 容器大于组件size时将组件置于容器中央

	private int sfill = GridBagConstraints.BOTH; // 窗口拉大时会填满水平与垂直空间

	Insets sinset = new Insets(0, 0, 5, 0); // 组件间间距

	private int sipadx = 0; // 组件内水平宽度

	private int sipady = 0;

	private GridBagConstraints sc;

	Object body[][] = new Object[1][29];

	String title[] = { "MMS编号", "SPID", "SID", "SCODE", "SADD", "CHARGEDID", "MMSID", "MMCL", "TIME", "ETIME", "EDTIME", "DPORT", "RREPLY", "REPLYING", "REPLYLINE", "REPLAYSIZE", "PRIORITY",
			"SUBJECT", "ALLOW", "CHARGED", "CONTENT", "DISTR", "TO", "CC", "BCC", "FLAG", "LIKED", "CTYPE", "CID" };

	public MmsDb() {
		super("数据库操作");
		this.setSize(1000, 600);
		this.setLocation(100, 100);
		GridBagLayout sgridbag = new GridBagLayout();
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.getContentPane().setLayout(sgridbag);
		paneOne = new JPanel();
		paneTwo = new JPanel();

		sc = new GridBagConstraints(sgridx, sgridy, sgridwidth, sgridheight, sweightx, sweighty, sanchor, sfill, sinset, sipadx, sipady);
		sgridbag.setConstraints(paneOne, sc);
		this.getContentPane().add(paneOne);
		sgridy = 1;
		sc = new GridBagConstraints(sgridx, sgridy, sgridwidth, sgridheight, sweightx, sweighty, sanchor, sfill, sinset, sipadx, sipady);
		sgridbag.setConstraints(paneTwo, sc);
		this.getContentPane().add(paneTwo);

		add = new JButton("添加");
		select = new JButton("显示");
		update = new JButton("更改");
		del = new JButton("删除");

		add.addActionListener(this);
		select.addActionListener(this);
		update.addActionListener(this);
		del.addActionListener(this);

		paneOne.add(add);
		paneOne.add(select);
		paneOne.add(update);
		paneOne.add(del);

		JTable table = new JTable(body, title);
		paneTwo.add(new JScrollPane(table));//

		this.setVisible(true);
	}

	public static void main(String[] args) {

		MmsDb mDb = new MmsDb();
		mDb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	}

	public void actionPerformed(ActionEvent arg0) {

	}

}